-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow having YamlTestExtension include method name in test names #3253
Allow having YamlTestExtension include method name in test names #3253
Conversation
When publishing to JUnit xml style files there is no hierarchy, so some tools will just show the class name and description, making it hard to tell what tests were run, or failed. If YamlTestExtension is used in an environment where that is the case this can be used to have the output include the method name. For example: - showcasingTests(Embedded) - showcasingTests(MultiServer (Embedded then !current_version)) ... Instead of - YamlIntegrationTests - showcasingTests(Runner) - Embedded - MultiServer (Embedded then !current_version) I thought about making this configurable via system property, but I think having it configured by a constructor parameter aligns more with PRs FoundationDB#3252 and FoundationDB#3251
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine to me. I'm unclear as to why we wouldn't just always include the method names. I've definitely had trouble parsing our own JUnit reports when there are test failures due to the convention of not including the method name, and I'd be fine if they were just always there.
* Create a new extension with some configuration. | ||
* @param clusterFile a custom cluster file to use, or {@code null} to inherit it from the environment, namely | ||
* {@code FDB_CLUSTER_FILE}. | ||
* @param includeMethodInDescriptions Set this to {@code true} if publishing test results to something that cannot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just set this to true
always? Does the name look bad when running in an IDE or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, including the method name is generally redundant, and noisy.
vs
And in the gradle output, you would have:
2025-03-17T21:19:14.4449128Z
2025-03-17T21:19:14.4449615Z 2025-03-17T21:19:14.375445846Z YamlIntegrationTests > showcasingTests(Runner) > Embedded STARTED
2025-03-17T21:19:14.5447904Z 2025-03-17T21:19:14.496453802Z YamlIntegrationTests > showcasingTests(Runner) > Embedded SUCCESS (121ms)
2025-03-17T21:19:14.5448575Z
2025-03-17T21:19:14.5449089Z 2025-03-17T21:19:14.496870499Z YamlIntegrationTests > showcasingTests(Runner) > JDBC In-Process STARTED
2025-03-17T21:19:14.6447848Z 2025-03-17T21:19:14.626601851Z YamlIntegrationTests > showcasingTests(Runner) > JDBC In-Process SUCCESS (130ms)
2025-03-17T21:19:14.6448569Z
2025-03-17T21:19:14.6450225Z 2025-03-17T21:19:14.627089079Z YamlIntegrationTests > showcasingTests(Runner) > MultiServer (Embedded then !current_version) STARTED
2025-03-17T21:19:14.8448278Z 2025-03-17T21:19:14.793403399Z YamlIntegrationTests > showcasingTests(Runner) > MultiServer (Embedded then !current_version) SUCCESS (166ms)
2025-03-17T21:19:14.8448824Z
2025-03-17T21:19:14.8449315Z 2025-03-17T21:19:14.794018940Z YamlIntegrationTests > showcasingTests(Runner) > MultiServer (Embedded then !current_version) WITH {optionForceContinuation=true} STARTED
2025-03-17T21:19:15.0448535Z 2025-03-17T21:19:14.964409459Z YamlIntegrationTests > showcasingTests(Runner) > MultiServer (Embedded then !current_version) WITH {optionForceContinuation=true} SUCCESS (171ms)
2025-03-17T21:19:15.0449586Z
2025-03-17T21:19:15.0450027Z 2025-03-17T21:19:14.964792102Z YamlIntegrationTests > showcasingTests(Runner) > MultiServer (!current_version then Embedded) STARTED
2025-03-17T21:19:15.1448164Z 2025-03-17T21:19:15.119398097Z YamlIntegrationTests > showcasingTests(Runner) > MultiServer (!current_version then Embedded) SUCCESS (156ms)
2025-03-17T21:19:15.1448728Z
2025-03-17T21:19:15.1449230Z 2025-03-17T21:19:15.119984738Z YamlIntegrationTests > showcasingTests(Runner) > MultiServer (!current_version then Embedded) WITH {optionForceContinuation=true} STARTED
2025-03-17T21:19:15.3448437Z 2025-03-17T21:19:15.300290885Z YamlIntegrationTests > showcasingTests(Runner) > MultiServer (!current_version then Embedded) WITH {optionForceContinuation=true} SUCCESS (180ms)
2025-03-17T21:19:15.3449705Z
2025-03-17T21:19:15.3450243Z 2025-03-17T21:19:15.300698896Z YamlIntegrationTests > showcasingTests(Runner) > MultiServer (Embedded then 4.1.10.0) STARTED
2025-03-17T21:19:15.5448258Z 2025-03-17T21:19:15.460488896Z YamlIntegrationTests > showcasingTests(Runner) > MultiServer (Embedded then 4.1.10.0) SUCCESS (160ms)
2025-03-17T21:19:15.5448892Z
2025-03-17T21:19:15.5449378Z 2025-03-17T21:19:15.461002183Z YamlIntegrationTests > showcasingTests(Runner) > MultiServer (Embedded then 4.1.10.0) WITH {optionForceContinuation=true} STARTED
2025-03-17T21:19:15.6448180Z 2025-03-17T21:19:15.636162199Z YamlIntegrationTests > showcasingTests(Runner) > MultiServer (Embedded then 4.1.10.0) WITH {optionForceContinuation=true} SUCCESS (175ms)
2025-03-17T21:19:15.6448906Z
2025-03-17T21:19:15.6449269Z 2025-03-17T21:19:15.636672871Z YamlIntegrationTests > showcasingTests(Runner) > MultiServer (4.1.10.0 then Embedded) STARTED
2025-03-17T21:19:15.8448228Z 2025-03-17T21:19:15.779813140Z YamlIntegrationTests > showcasingTests(Runner) > MultiServer (4.1.10.0 then Embedded) SUCCESS (143ms)
2025-03-17T21:19:15.8448824Z
2025-03-17T21:19:15.8449566Z 2025-03-17T21:19:15.780267967Z YamlIntegrationTests > showcasingTests(Runner) > MultiServer (4.1.10.0 then Embedded) WITH {optionForceContinuation=true} STARTED
2025-03-17T21:19:15.9448248Z 2025-03-17T21:19:15.941185049Z YamlIntegrationTests > showcasingTests(Runner) > MultiServer (4.1.10.0 then Embedded) WITH {optionForceContinuation=true} SUCCESS (161ms)
vs
2025-03-17T21:19:14.4449615Z 2025-03-17T21:19:14.375445846Z YamlIntegrationTests > showcasingTests(Runner) > showcasingTests(Embedded STARTED)
2025-03-17T21:19:14.5447904Z 2025-03-17T21:19:14.496453802Z YamlIntegrationTests > showcasingTests(Runner) > showcasingTests(Embedded SUCCESS (121ms))
2025-03-17T21:19:14.5448575Z
2025-03-17T21:19:14.5449089Z 2025-03-17T21:19:14.496870499Z YamlIntegrationTests > showcasingTests(Runner) > showcasingTests(JDBC In-Process STARTED)
2025-03-17T21:19:14.6447848Z 2025-03-17T21:19:14.626601851Z YamlIntegrationTests > showcasingTests(Runner) > showcasingTests(JDBC In-Process SUCCESS (130ms))
2025-03-17T21:19:14.6448569Z
2025-03-17T21:19:14.6450225Z 2025-03-17T21:19:14.627089079Z YamlIntegrationTests > showcasingTests(Runner) > showcasingTests(MultiServer (Embedded then !current_version) STARTED)
2025-03-17T21:19:14.8448278Z 2025-03-17T21:19:14.793403399Z YamlIntegrationTests > showcasingTests(Runner) > showcasingTests(MultiServer (Embedded then !current_version) SUCCESS (166ms))
2025-03-17T21:19:14.8448824Z
2025-03-17T21:19:14.8449315Z 2025-03-17T21:19:14.794018940Z YamlIntegrationTests > showcasingTests(Runner) > showcasingTests(MultiServer (Embedded then !current_version) WITH {optionForceContinuation=true} STARTED)
2025-03-17T21:19:15.0448535Z 2025-03-17T21:19:14.964409459Z YamlIntegrationTests > showcasingTests(Runner) > showcasingTests(MultiServer (Embedded then !current_version) WITH {optionForceContinuation=true} SUCCESS (171ms))
2025-03-17T21:19:15.0449586Z
2025-03-17T21:19:15.0450027Z 2025-03-17T21:19:14.964792102Z YamlIntegrationTests > showcasingTests(Runner) > showcasingTests(MultiServer (!current_version then Embedded) STARTED)
2025-03-17T21:19:15.1448164Z 2025-03-17T21:19:15.119398097Z YamlIntegrationTests > showcasingTests(Runner) > showcasingTests(MultiServer (!current_version then Embedded) SUCCESS (156ms))
2025-03-17T21:19:15.1448728Z
2025-03-17T21:19:15.1449230Z 2025-03-17T21:19:15.119984738Z YamlIntegrationTests > showcasingTests(Runner) > showcasingTests(MultiServer (!current_version then Embedded) WITH {optionForceContinuation=true} STARTED)
2025-03-17T21:19:15.3448437Z 2025-03-17T21:19:15.300290885Z YamlIntegrationTests > showcasingTests(Runner) > showcasingTests(MultiServer (!current_version then Embedded) WITH {optionForceContinuation=true} SUCCESS (180ms))
2025-03-17T21:19:15.3449705Z
2025-03-17T21:19:15.3450243Z 2025-03-17T21:19:15.300698896Z YamlIntegrationTests > showcasingTests(Runner) > showcasingTests(MultiServer (Embedded then 4.1.10.0) STARTED)
2025-03-17T21:19:15.5448258Z 2025-03-17T21:19:15.460488896Z YamlIntegrationTests > showcasingTests(Runner) > showcasingTests(MultiServer (Embedded then 4.1.10.0) SUCCESS (160ms))
2025-03-17T21:19:15.5448892Z
2025-03-17T21:19:15.5449378Z 2025-03-17T21:19:15.461002183Z YamlIntegrationTests > showcasingTests(Runner) > showcasingTests(MultiServer (Embedded then 4.1.10.0) WITH {optionForceContinuation=true} STARTED)
2025-03-17T21:19:15.6448180Z 2025-03-17T21:19:15.636162199Z YamlIntegrationTests > showcasingTests(Runner) > showcasingTests(MultiServer (Embedded then 4.1.10.0) WITH {optionForceContinuation=true} SUCCESS (175ms))
2025-03-17T21:19:15.6448906Z
2025-03-17T21:19:15.6449269Z 2025-03-17T21:19:15.636672871Z YamlIntegrationTests > showcasingTests(Runner) > showcasingTests(MultiServer (4.1.10.0 then Embedded) STARTED)
2025-03-17T21:19:15.8448228Z 2025-03-17T21:19:15.779813140Z YamlIntegrationTests > showcasingTests(Runner) > showcasingTests(MultiServer (4.1.10.0 then Embedded) SUCCESS (143ms))
2025-03-17T21:19:15.8448824Z
2025-03-17T21:19:15.8449566Z 2025-03-17T21:19:15.780267967Z YamlIntegrationTests > showcasingTests(Runner) > showcasingTests(MultiServer (4.1.10.0 then Embedded) WITH {optionForceContinuation=true} STARTED)
2025-03-17T21:19:15.9448248Z 2025-03-17T21:19:15.941185049Z YamlIntegrationTests > showcasingTests(Runner) > showcasingTests(MultiServer (4.1.10.0 then Embedded) WITH {optionForceContinuation=true} SUCCESS (161ms))
Similarly a failed test in the summary might be something like:
❌ YamlIntegrationTests > showcasingTests(Runner) > MultiServer (4.1.10.0 then Embedded) WITH {optionForceContinuation=true}
vs.
❌ YamlIntegrationTests > showcasingTests(Runner) > showcasingTests(MultiServer (4.1.10.0 then Embedded) WITH {optionForceContinuation=true}
The html test report is worse though, if you look at the failing tests, it does not include the method name, here is a parameterized test from a failed nightly run:
Following the link also doesn't add the method name, you have to find it via the stack trace....
Not including the method name is aligned with the default behavior of other junit test template annotations such as @ParameterizedTest
and @RepeatedTest
, so it seems like aligning our reporting with this behavior seems worthwhile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And I did some investigation into that HTML report, and it looks like the title there is hardcoded:
https://github.com/gradle/gradle/blob/1f2f66e0320559f3391cee8f79ba96dccd6cebcc/platforms/software/testing-base/src/main/java/org/gradle/api/internal/tasks/testing/report/PageRenderer.java#L76
When publishing to JUnit xml style files there is no hierarchy, so some tools will just show the class name and description, making it hard to tell what tests were run, or failed. If YamlTestExtension is used in an environment where that is the case this can be used to have the output include the method name. For example:
Instead of
I thought about making this configurable via system property, but I think having it configured by a constructor parameter aligns more with PRs #3252 and #3251
Note: This is a breaking change if someone is depending on
YamlTestExtension
, but only if they are depending on the recently merged #3251